<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title> node document </title>
</head>

<body>

  <div>This is content, and data is: <span id="data"></span></div>
  <button id="button">click me</button>
</body>

<script>
let index = 0
const doRequest = () => {
  const data = document.getElementById('data')

  data.innerText = ''

  fetch('/data', {
    headers: {
      'X-Test-Cache': index ++
    }
  }).then( (resp) => {
    console.log("node 接口 返回值-----------", resp)
    return resp.text()

  }).then( (text) => {
    console.log("node 接口 回填到页面-----------", text)
    data.innerText = text
  })
}

document.getElementById('button').addEventListener('click', doRequest)
</script>
</html>